package com.guoxin.artconcurrency.chapter3;

/**
 * @author guoxin
 * @date 2019/7/23
 */
public class FinalReferenceExample {
    /**
     * final 是引用类型
     */
    final int[] intArray;
    static FinalReferenceExample obj;

    public FinalReferenceExample() {
        intArray = new int[1];
        intArray[0] = 1;
    }

    public static void writerOne() {
        obj = new FinalReferenceExample();
    }

    public static void writerTwo() {
        obj.intArray[0] = 2;
    }

    public static void reader() {
        if (obj != null) {
            int temp1 = obj.intArray[0];
        }
    }
}
